﻿@model bugtracker.Models.Bug

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Bug</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Criticality)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Criticality,
                                    new SelectList(bugtracker.Controllers.DataController.getCriticalityTypes(),
                                    "ID",
                                    "Name",
                                    4))
            @Html.ValidationMessageFor(model => model.Criticality)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PriorityID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PriorityID)
            @Html.ValidationMessageFor(model => model.PriorityID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StatusID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.StatusID,
                                    new SelectList(bugtracker.Controllers.DataController.getStatusTypes(),
                                    "ID",
                                    "Name",
                                    0),
                                    new { disabled = true } )
            @Html.ValidationMessageFor(model => model.StatusID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.BugTypeID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.BugTypeID,
                                    new SelectList(bugtracker.Controllers.DataController.getBugTypes(),
                                    "ID",
                                    "Name",
                                    4))
            @Html.ValidationMessageFor(model => model.BugTypeID)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
